package com.blocks.mq.producer.reader.impl;

import com.blocks.mq.producer.reader.Reader;

import java.io.FileInputStream;
import java.io.IOException;

public class TXTReader implements Reader {



    @Override
    public String reader(String path) throws IOException {
        StringBuilder str= new StringBuilder("");

            FileInputStream fis = new FileInputStream(path);
//        int len=fis.read();
//        System.out.println(len);
//        int len1=0;


//
//        int len=0;
//        while((len=fis.read())!=-1){
//            System.out.println((char)len);
//        }
//        fis.close();


            int len = 0;
            byte[] bytes = new byte[1024];
            while ((len = fis.read(bytes)) != -1) {
               str.append(new String(bytes, 0, len));

            }
            fis.close();

            return str.toString();




    }
}
